package com.gin.kotlin.no_gay_alliance.database.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.gin.kotlin.no_gay_alliance.database.entity.TopicBookmark

@Dao
interface TopicBookmarkDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun add(topicBookmark: TopicBookmark)

    @Query("delete from TopicBookmark where topicId=:topicId")
    fun clear(topicId:Long)

    @Query("delete from TopicBookmark where id=:id")
    fun del(id:Long)

    @Query("select * from TopicBookmark where topicId=:topicId order by timestamp desc")
    fun queryByTopicId(topicId: Long)  :List<TopicBookmark>?
}